function CustomerManager(){
    var ap = new AjaxOperator();
    this.findAll=function(url,callBack){
        ap.sendGet(url,callBack);
    }
    this.addCustomer=function(url,customer,callBack){
        ap.sendPost(url,customer,callBack);
    }
    this.render=function(thbody,customers){
    	thbody.empty();
        if(!customers.length){
            return;
        }
        customers.forEach((item,index)=>{
            var tr = $("<tr>");
            tr.append($("<td>").text(item.id));
            tr.append($("<td>").text(item.name));
            if(item.sex){
                tr.append($("<td>").text("male"));
            }else {
                tr.append($("<td>").text("female"));
            }
            tr.append($("<td>").text(item.salary));
            tr.append($("<td>").text(this.formatDate(new Date(item.birth))));
            tr.append($("<td>").append(
                $("<button>").addClass("btn btn-primary delete").attr("id",item.id).text("delete"))
                .append("&nbsp;&nbsp;")
                .append($("<button>").addClass("btn btn-primary update")
                		.attr("id",item.id)
                		.attr("data-toggle","modal")
                		.attr("data-target","#updateModal").text("update")));
            thbody.append(tr);
        });
    }
    this.addDeleteEvent=function(url,callBack){
    	$("button.delete").on("click",function(e){
    		var id = $(this).attr("id");
            ap.sendDelete(url+"?cid="+id,callBack);
        });
    }
}